Create Session

Request to create a payment session. A payment session can be used to temporarily store any of the request fields of operations that allow a session identifier as a request field.

The request fields stored in the session may then be used in these operations by providing the session identifier. They may be updated and obtained using the Update Session and Retrieve Session operation respectively.

POST https://test-rakbankpay.mtf.gateway.mastercard.com/api/rest/version/59 / merchant / {merchantId} / session

Authentication Copied to clipboard

This operation requires authentication via one of the following methods:


  • Certificate authentication.
  • Basic HTTP authentication as described at w3.org. Provide 'merchant.<your gateway merchant ID>' in the userid portion and your API password in the password portion.

Request Copied to clipboard

URL Parameters Copied to clipboard

{merchantId} Copied to clipboard Alphanumeric + additional characters REQUIRED

The unique identifier issued to you by your payment provider.


This identifier can be up to 12 characters in length.


Data may consist of the characters 0-9, a-z, A-Z, '-', '_'

Min length: 1 Max length: 40

Fields Copied to clipboard

To view the optional fields, please toggle on the "Show optional fields" setting.

correlationId Copied to clipboard String OPTIONAL

A transient identifier for the request, that can be used to match the response to the request.

The value provided is not validated, does not persist in the gateway, and is returned as provided in the response to the request.

Data can consist of any characters

Min length: 1 Max length: 100
session.authenticationLimit Copied to clipboard Integer OPTIONAL

The number of operations which may be submitted to the gateway using this session id as a password.

This field applies when you write a browser or mobile app that issues operations to the gateway from the device, using the session id as a password.

In that case, a payer (or a compromised browser), could issue a large number of requests to the gateway on your behalf, and you could incur unnecessary fees as a result.

This field lets you limit your exposure to that risk. The value defaulted by the gateway is suitable for typical payments. There is an upper limit (your operation will be rejected if that limit is exceeded).

JSON number data type, restricted to being positive or zero. In addition, the represented number may have no fractional part.

Min value: 0 Max value: 25

Response Copied to clipboard

Fields Copied to clipboard

correlationId Copied to clipboard String CONDITIONAL

A transient identifier for the request, that can be used to match the response to the request.

The value provided is not validated, does not persist in the gateway, and is returned as provided in the response to the request.

Data can consist of any characters

Min length: 1 Max length: 100
lineOfBusiness Copied to clipboard String CONDITIONAL

Your payment service provider might have configured your merchant profile to support several lines of business.

Each line of business can have different payment parameters, such as bank account, supported cards or such.

For example, lineOfBusiness = TICKET_SALES can have a different bank account from lineOfBusiness = MERCHANDISING. One line of business on your profile might be "null". To use that, do not provide the lineOfBusiness field.

Data can consist of any characters except space

Min length: 1 Max length: 100
merchant Copied to clipboard Alphanumeric + additional characters ALWAYS PROVIDED

The unique identifier issued to you by your payment provider.

This identifier can be up to 12 characters in length.

Data may consist of the characters 0-9, a-z, A-Z, '-', '_'

Min length: 1 Max length: 40
result Copied to clipboard Enumeration ALWAYS PROVIDED

A system-generated high level overall result of the transaction/operation.

Value must be a member of the following list. The values are case sensitive.

FAILURE

The operation was declined or rejected by the gateway, acquirer or issuer

PENDING

The operation is currently in progress or pending processing

SUCCESS

The operation was successfully processed

UNKNOWN

The result of the operation is unknown

session.aes256Key Copied to clipboard ASCII Text ALWAYS PROVIDED

The key you can use to decrypt sensitive data passed to your website via the payers's browser or mobile device.

For some gateway operations invoked via a payer device, you supply your website as a return URL.

On return to your website, the gateway will encrypt sensitive data using this symmetric key. Most integrations do not need that sensitive data, and can ignore this parameter.

This is a Base64 encoded AES256 key, generated uniquely for this session.

This key should never be exposed to the payer environment.

Data consists of ASCII characters

Min length: 44 Max length: 44
session.authenticationLimit Copied to clipboard Integer ALWAYS PROVIDED

The number of operations which may be submitted to the gateway using this session id as a password.

This field applies when you write a browser or mobile app that issues operations to the gateway from the device, using the session id as a password.

In that case, a payer (or a compromised browser), could issue a large number of requests to the gateway on your behalf, and you could incur unnecessary fees as a result.

This field lets you limit your exposure to that risk. The value defaulted by the gateway is suitable for typical payments. There is an upper limit (your operation will be rejected if that limit is exceeded).

JSON number data type, restricted to being positive or zero. In addition, the represented number may have no fractional part.

Min value: 0 Max value: 9999
session.id Copied to clipboard ASCII Text ALWAYS PROVIDED

The identifier for the payment session.

You can add request fields to the session using a Hosted Payment Form or wallet provider interaction, or the Update Session operation.

Data consists of ASCII characters

Min length: 31 Max length: 35
session.updateStatus Copied to clipboard Enumeration ALWAYS PROVIDED

A summary of the outcome of the last attempt to modify the session.

In order to perform an operation using this session this value must be SUCCESS.

Value must be a member of the following list. The values are case sensitive.

FAILURE

The last attempt to place data into the session was unsuccessful. The session may contain invalid data. A request operation using this session will be rejected by the payment gateway.

NO_UPDATE

No attempt has been made to place data into the session. A request operation using this session will be rejected by the payment gateway.

SUCCESS

The last attempt to update the session was successful. You may submit a request operation using this session.

session.version Copied to clipboard ASCII Text ALWAYS PROVIDED

Use this field to implement optimistic locking of the session content.

Do this if you make business decisions based on data from the session and wish to ensure that the same data is being used for the request operation.

To use optimistic locking, record session.version when you make your decisions, and then pass that value in session.version when you submit your request operation to the gateway.

See Making Business Decisions Based on Session Content.

Data consists of ASCII characters

Min length: 10 Max length: 10

Errors Copied to clipboard

error Copied to clipboard

Information on possible error conditions that may occur while processing an operation using the API.

error.cause Copied to clipboard Enumeration

Broadly categorizes the cause of the error.

For example, errors may occur due to invalid requests or internal system failures.

Value must be a member of the following list. The values are case sensitive.

INVALID_REQUEST

The request was rejected because it did not conform to the API protocol.

REQUEST_REJECTED

The request was rejected due to security reasons such as firewall rules, expired certificate, etc.

SERVER_BUSY

The server did not have enough resources to process the request at the moment.

SERVER_FAILED

There was an internal system failure.

error.explanation Copied to clipboard String

Textual description of the error based on the cause.

This field is returned only if the cause is INVALID_REQUEST or SERVER_BUSY.

Data can consist of any characters

Min length: 1 Max length: 1000
error.field Copied to clipboard String

Indicates the name of the field that failed validation.

This field is returned only if the cause is INVALID_REQUEST and a field level validation error was encountered.

Data can consist of any characters

Min length: 1 Max length: 100
error.supportCode Copied to clipboard String

Indicates the code that helps the support team to quickly identify the exact cause of the error.

This field is returned only if the cause is SERVER_FAILED or REQUEST_REJECTED.

Data can consist of any characters

Min length: 1 Max length: 100
error.validationType Copied to clipboard Enumeration

Indicates the type of field validation error.

This field is returned only if the cause is INVALID_REQUEST and a field level validation error was encountered.

Value must be a member of the following list. The values are case sensitive.

INVALID

The request contained a field with a value that did not pass validation.

MISSING

The request was missing a mandatory field.

UNSUPPORTED

The request contained a field that is unsupported.

result Copied to clipboard Enumeration

A system-generated high level overall result of the operation.

Value must be a member of the following list. The values are case sensitive.

ERROR

The operation resulted in an error and hence cannot be processed.